﻿using System;
using System.Windows.Forms;
using SSAT.Forms;
using SSAT.Utils;

namespace SSAT
{
    static class Program
    {
        [STAThread]
        static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }

        private static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Logging.Handle(e.ExceptionObject as Exception);
            string errorMessage = Logging.GetExceptionMessage(e.ExceptionObject);
            UIHelper.ShowErrorDialog(string.Format(Resources.UnhandledExceptionOccured, errorMessage));
        }
    }
}
